package define

import (
	"gitee.com/jjawesomejj/awesomehttp/system/helper"
	"gitee.com/jjawesomejj/awesomehttp/system/httpContext"
)

type BaseResponse struct {
	Data  interface{} `json:"data"`
	Ptime float64     `json:"ptime"`
	Errno int         `json:"errno"`
	Msg   string      `json:"msg"`
}

func JsonResponse(ctx httpContext.HttpContext, response interface{}) BaseResponse {
	return BaseResponse{
		Data:  response,
		Ptime: helper.NowFloat() - ctx.StartAt,
		Errno: 0,
		Msg:   "success",
	}
}
